package com.nz2004.deaddelayedqueue.mq;

import com.nz2004.deaddelayedqueue.config.RabbitMQConfig;
import com.rabbitmq.client.Channel;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.io.IOException;

/**
 * @author ReJoice
 */
@Component
public class BizListener {
    @RabbitListener(queues = {RabbitMQConfig.BIZ_QUEUE})
    public void listen(Message message, Channel channel) throws IOException {
        System.out.println("【业务队列】 接收到消息,拒绝消息,msg = " + new String(message.getBody()));
        channel.basicReject(message.getMessageProperties().getDeliveryTag(),false);
        System.out.println("---------");
    }


}
